Converting Data from One Format to Another

The ACM uses stream functions to support data format conversion. Converters in the ACM change the format, but not the data type. For example, a converter module can change 44-kHz, 16-bit data to 44-kHz, 8-bit data.

The following ACM functions support data format conversion. They are listed in the order in which you would typically use them.

    The acmStreamOpen1C.JACT function opens a conversion stream.

    The acmStreamSize1C.N0XK function calculates the appropriate size of the source or destination buffer.

    The acmStreamPrepareHeaderJYX_5I function prepares source and destination buffers to be used in a conversion.

    The acmStreamConvertBQ6UH9 function converts data in a source buffer into the destination format, writing the converted data into the destination buffer.

    The acmStreamUnprepareHeaderAR.K36 function cleans up the source and destination buffers prepared by acmStreamPrepareHeader. You must call this function before freeing the source and destination buffers.

    The acmStreamCloseCMXLEK function closes a conversion stream.

 

When converting data, first identify the source format, then choose the destination format. The easiest way to do this is by using the acmFormatChoose21ZW2Z0 function, which displays a format-selection dialog box and returns the user s format choice.

When you know the source and destination formats, you can use acmStreamOpen1C.JACT to open a conversion stream. Then you can use the acmStreamSize1C.N0XK function to determine the appropriate buffer sizes.

The next step is to prepare the buffers to be used in the conversion by using acmStreamPrepareHeaderJYX_5I.

To perform the conversion, use acmStreamConvertBQ6UH9 until all the buffers have been processed. When the conversion is complete, use acmStreamUnprepareHeaderAR.K36 to clean up the buffers and then use acmStreamCloseCMXLEK to close the conversion stream.